/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mapping;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Andres
 */
@Entity
@Table(name = "red")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Red.findAll", query = "SELECT r FROM Red r"),
    @NamedQuery(name = "Red.findByIdRed", query = "SELECT r FROM Red r WHERE r.idRed = :idRed"),
    @NamedQuery(name = "Red.findByNombrered", query = "SELECT r FROM Red r WHERE r.nombrered = :nombrered")})
public class Red implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "idRed")
    private String idRed;
    @Column(name = "nombrered")
    private String nombrered;
    @OneToMany(mappedBy = "idRed")
    private Collection<DetallesRed> detallesRedCollection;

    public Red() {
    }

    public Red(String idRed) {
        this.idRed = idRed;
    }

    public String getIdRed() {
        return idRed;
    }

    public void setIdRed(String idRed) {
        this.idRed = idRed;
    }

    public String getNombrered() {
        return nombrered;
    }

    public void setNombrered(String nombrered) {
        this.nombrered = nombrered;
    }

    @XmlTransient
    public Collection<DetallesRed> getDetallesRedCollection() {
        return detallesRedCollection;
    }

    public void setDetallesRedCollection(Collection<DetallesRed> detallesRedCollection) {
        this.detallesRedCollection = detallesRedCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRed != null ? idRed.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Red)) {
            return false;
        }
        Red other = (Red) object;
        if ((this.idRed == null && other.idRed != null) || (this.idRed != null && !this.idRed.equals(other.idRed))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.mapping.Red[ idRed=" + idRed + " ]";
    }
    
}
